﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;

namespace ImageResizer
{
    enum Orientation
    {
        Straight = 1,
        Left = 6,
        Right = 8
    }

    class ExifTags
    {
        internal const int Orientation = 0x112;
    }

    class ExifImageInfo
    {
        internal static Orientation GetOrientation(Image img)
        {
            foreach (PropertyItem pi in img.PropertyItems)
            {
                if (pi.Id == ExifTags.Orientation)
                {
                    return (Orientation)pi.Value[0];
                }
            }
            return Orientation.Straight;
        }

        internal static bool NeedRotate(Image img)
        {
            return GetOrientation(img) != Orientation.Straight;
        }
    }
}
